<?php
namespace app\common\model;

use think\Model;

class Recharge extends Model{


    protected $table = "jiujiu_recharge";



     public function getAllRecharge(){

         return $this->where('isDelete',0)->paginate();

     }


    public function changeShow($i,$v){

        $this->where('id',$i)->update([
            'isShow'=>$v
        ]);

    }


    public function deleteRecharge($id){

        $this->where('id',$id)->update(['isDelete'=>1]);

    }




    public function saveRecharge($data){

        if(isset($data['id'])){
            $this->where('id',$data['id'])->update($data);
        }
        else{

            $this->insertGetId($data);

        }
    }




    public function getSaleRecharge(){
         return $this->where('isShow',1)->where('isDelete',0)->select();
     }









}